using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using System;
using System.Collections.Generic;
namespace MicroMsg.Plugin.Sns.Scene
{
	public class NetSceneHttpDownloadService
	{
		private const string TAG = "NetSceneHttpDownloadService";
		private static List<NetSceneHttpDownload> mList = new List<NetSceneHttpDownload>();
		private static EventWatcher mWatcher = null;
		public static void getRequest(DownloadMediaContext context)
		{
			if (context == null)
			{
				return;
			}
			if (NetSceneHttpDownloadService.mWatcher == null)
			{
				NetSceneHttpDownloadService.mWatcher = new EventWatcher(null, null, new EventHandlerDelegate(NetSceneHttpDownloadService.HandlerOnLogout));
				EventCenter.registerEventWatcher(EventConst.ON_ACCOUNT_LOGOUT, NetSceneHttpDownloadService.mWatcher);
			}
			NetSceneHttpDownload netSceneHttpDownload = new NetSceneHttpDownload();
			netSceneHttpDownload.getRequest(context);
			NetSceneHttpDownloadService.mList.Add(netSceneHttpDownload);
		}
		private static void HandlerOnLogout(EventWatcher watcher, BaseEventArgs evtArgs)
		{
			if (NetSceneHttpDownloadService.mList == null)
			{
				return;
			}
			Log.smethod_5("NetSceneHttpDownloadService", "clearn task on logout.. " + NetSceneHttpDownloadService.mList.get_Count());
			NetSceneHttpDownloadService.mList.Clear();
		}
		public static void onRequestFinished(NetSceneHttpDownload httpDownload)
		{
			NetSceneHttpDownloadService.mList.Remove(httpDownload);
		}
	}
}
